package base;

import org.junit.Test;

import java.util.Arrays;
import java.util.List;
import java.util.function.BiPredicate;
import java.util.function.Predicate;

/**
 * @author liweimin
 * @date 2021/4/15 11:07
 * @description
 * @since
 */
public class SimpleTest {

    @Test
    public void test1() {
        //十进制0
        int i = 00071;

        //十六进制0X
        int a = 0x00AC;
        System.out.println(i);
        System.out.println(a);

        //二进制
        System.out.println(Integer.toBinaryString(i));
        System.out.println(Integer.toBinaryString(a));
    }


    @Test
    public void test2() {
        List<Integer> list = Arrays.asList(new Integer[]{11, 23, 41, 15, 6, 3, 2, 12, 32});
        Predicate<Integer> predicate = integer -> integer.intValue() > 10;
        BiPredicate<Integer, Integer> biPredicate = (o1, o2) -> {
            if (o1 == 0) {
                return true;
            } else {
                return o1.intValue() == o2.intValue();
            }
        };
//        StreamEx
//        list.stream().filter(t -> t.intValue() != 1).filter(t -> t.intValue() > 4).filter(predicate).filter(biPredicate).forEach(System.out::println);
        list.stream().filter(predicate).map(t->t+5).filter(t->t.intValue()>=20).forEach(System.out::println);
    }
}
